#include <stdio.h>
#include <omp.h>
//编译指令
//gcc -std=c99 -fopenmp 5NonIterativeStructureParallelism.c -o cmake-build/5NonIterativeStructureParallelism && export OMP_NUM_THREADS=512 && time ./cmake-build/5NonIterativeStructureParallelism

void aaa(void)
{
    printf("aaa\n");
}
void bbb(void)
{
    printf("bbb\n");
}
void ccc(void)
{
    printf("ccc\n");
}
void ddd(void)
{
    printf("ddd\n");
}
void eee(void)
{
    printf("eee\n");
}
void fff(void)
{
    printf("fff\n");
}
void ggg(void)
{
    printf("ggg\n");
}
void hhh(void)
{
    printf("hhh\n");
}
void test1(void)
{
    aaa();
    bbb();
    ccc();
    ddd();
    eee();
    fff();
    ggg();
    hhh();
    printf("========================================\n");
}
void test2(void)
{
    #pragma omp parallel sections default(none)
    {
        #pragma omp section
        aaa();
        #pragma omp section
        bbb();
        #pragma omp section
        ccc();
        #pragma omp section
        ddd();
        #pragma omp section
        eee();
        #pragma omp section
        fff();
        #pragma omp section
        ggg();
        #pragma omp section
        hhh();
    }
    printf("========================================\n");
}
void test3(void)
{
    #pragma omp parallel default(none)
    {
        #pragma omp sections
        {
            #pragma omp section
            aaa();
            #pragma omp section
            bbb();
            #pragma omp section
            ccc();
            #pragma omp section
            ddd();
        }
        #pragma omp sections
        {
            #pragma omp section
            eee();
            #pragma omp section
            fff();
            #pragma omp section
            ggg();
            #pragma omp section
            hhh();
        }
    }
    printf("========================================\n");
}
int main()
{
    test1();
    test2();
    test3();
    return 0;
}

